import { getFibsemInfo, reqQemscanImg } from '@/service/maps';
import { message } from 'antd';

const Model = {
    namespace: 'fibsem',
    state: {
        fibsemId: 0,
        fibsemInfo: {},
        fibsemImg: {}
    },
    effects: {
        *getInfo({ payload }, { put, call }) {
            console.log('fibseminfo');
            const res = yield call(getFibsemInfo, payload)
            console.log('res', res)
            if (res.code == 200) {
                yield put({
                    type: 'saveFibsemInfo',
                    payload: res.raw
                })
            } else {
                message.error('fibsem请求出错')
            }
        },
        *getfibsemImg({ payload }, { put, call }) {
            const res = yield call(reqQemscanImg, payload)
            if (res.code == 200) {
               
                yield put({
                    type: 'saveFibsemImg',
                    payload: res.img
                })
            }
        }
    },
    reducers: {
        saveFibsemInfo(state, { payload }) {
            return { ...state, fibsemInfo: payload }
        },
        saveFibsemImg(state, { payload }) {
            return { ...state, fibsemImg: payload }
        }
    }
}
export default Model